import demo2.ListNode;
import demo2.MySingleList;
import demo2.SomeExams;

public class Test {






    private static ListNode head; // 表示当前链表的头节点
    private static SomeExams linkList = new SomeExams();

    private static ListNode list1;
    private static ListNode list2;





















    public static void main5(String[] args) {
        ListNode node1 = new ListNode(10);
        ListNode node2 = new ListNode(11);
        ListNode node3 = new ListNode(12);
        ListNode node4 = new ListNode(13);
        ListNode node5 = new ListNode(14);
        ListNode node6 = new ListNode(15);
        node1.next = node2;
        node2.next = node3;
        node3.next = node4;
        node4.next = node5;
        node5.next = node6;
        node6.next = null;
        head = node1;

        Boolean a = linkList.hasCycle(head);
        System.out.println(a);



    }












    public static void main4(String[] args) {
        ListNode node1 = new ListNode(12);
        ListNode node2 = new ListNode(23);
//        ListNode node3 = new ListNode(100);
        ListNode node4 = new ListNode(23);
        ListNode node5 = new ListNode(12);

        node1.next = node2;
        node2.next = node4;
//        node3.next = node4;
        node4.next = node5;
        list1 = node1;
        linkList.display(list1);
        Boolean a = linkList.chkPalindrome(list1);
        System.out.println(a);
//        linkList.partition(list1,20);
//        linkList.display(list1);

    }




    public static void main3(String[] args) {
        ListNode node1 = new ListNode(12);
        ListNode node2 = new ListNode(23);
        ListNode node3 = new ListNode(45);
        ListNode node4 = new ListNode(56);
        ListNode node5 = new ListNode(76);

        node1.next = node2;
        node2.next = node3;
        node3.next = node4;
        node4.next = node5;
        list1 = node1;


        ListNode node11 = new ListNode(2);
        ListNode node21 = new ListNode(5);
        ListNode node31 = new ListNode(15);
        ListNode node41 = new ListNode(26);
        ListNode node51= new ListNode(100);

        node11.next = node21;
        node21.next = node31;
        node31.next = node41;
        node41.next = node51;
        list2 = node11;

        linkList.display(list1);
        linkList.display(list2);
        head = linkList.mergeTwoLists(list1,list2);
        linkList.display(head);


    }




    public static void main2(String[] args) {



        ListNode node1 = new ListNode(12);
        ListNode node2 = new ListNode(23);
        ListNode node3 = new ListNode(45);
        ListNode node4 = new ListNode(56);
        ListNode node5 = new ListNode(76);

        node1.next = node2;
        node2.next = node3;
        node3.next = node4;
        node4.next = node5;
        head = node1;


//        head = linkList.reverseList(head);
        head = linkList.addFirst(head,10);
        head = linkList.addFirst(head,20);
        head = linkList.addFirst(head,30);
        linkList.display(head);

        ListNode lastNode = linkList.FindKthToTail(head,4);
        System.out.println(lastNode.val);





//        linkList.display(head);
//
//
//        ListNode midNode = linkList.middleNode(head);
//        System.out.println(midNode.val);








//        SomeExams someExams = new SomeExams();
//        someExams.createList();
//        someExams.display();
//        someExams.reverseList();
//        someExams.display();


    }

    public static void main1(String[] args) {
        MySingleList mySingleList = new MySingleList();
        mySingleList.createList();
        mySingleList.display();
//        mySingleList.addLast(23);
//        mySingleList.addFirst(23);
//        mySingleList.remove(12);
//        mySingleList.display();
//        mySingleList.removeAllKey(23);
        mySingleList.clear();
        mySingleList.display();
        System.out.println("---------------");









//        mySingleList.addFirst(100);
//        mySingleList.display();
//        mySingleList.addLast(200);
//        mySingleList.display();
//        mySingleList.addIndex(0,1);
//        mySingleList.display();
//        mySingleList.remove(200);
//        mySingleList.display();


//        int count =  mySingleList.size();
//        System.out.println(count);
//        System.out.println(mySingleList.contains(12));
    }


}
